package com.soft.javase.day10.practice.streamdemo1;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/5/4
 */
public class StreamDemo1 {
    public static void main(String[] args) {
        List<String> list1 = Arrays.asList("张三丰", "李小龙", "王五", "赵六", "孙七", "周八");
        List<String> list2 = Arrays.asList("张无忌", "张翠山", "张三", "李四", "王二麻子", "张伟");

        Stream<String> stream1 = list1.stream()
                .filter(name -> name.length() == 3)
                .limit(3);

        Stream<String> stream2 = list2.stream()
                .filter(name -> name.startsWith("张"))
                .skip(2);

        Stream.concat(stream1, stream2).map(Person::new).forEach(System.out::println);

    }
}
